package com.smt.modules.app.controller;

import com.smt.common.utils.R;
import com.smt.modules.app.annotation.Conceptual;
import com.smt.modules.app.annotation.Login;
import com.smt.modules.app.annotation.LoginUser;
import com.smt.modules.bus.entity.MemberUserEntity;
import com.smt.modules.bus.service.ConceptualProgressService;
import com.smt.modules.bus.vo.request.ConceptualReq;
import com.smt.modules.bus.vo.request.SituationReq;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 概念进度
 *
 * @author zhangyi
 * @date 2018/10/8 16:40
 */
@RestController
@RequestMapping("/app/progress")
@Api(tags = {"AppConceptualController"},description = "各个进度数据显示(客户端接口)")
public class AppConceptualController {

    @Resource
    private ConceptualProgressService conceptualProgressService;

    /**
     * 获取各个阶段的任务进度
     *
     * @return
     */
    @Login
    @GetMapping("/progresses")
    @Conceptual
    @ApiOperation(value = "阶段进度",httpMethod = "GET")
    public R progresses(ConceptualReq conceptualReq, @RequestAttribute("userId") Long userId){

        return conceptualProgressService.progresses(conceptualReq,userId);
    }
    /**
     * 获取各个阶段的任务状况
     *
     * @return
     */
    @GetMapping("/situation")
    @Conceptual
    @ApiOperation(value = "获取各个阶段的任务状况",httpMethod = "GET")
    public R situation(@Validated SituationReq situationReq){

        return conceptualProgressService.situation(situationReq);
    }

    /**
     * 获取当前项目的所有成员
     *
     * @return
     */
    @GetMapping("/memberLists/{projectId}")
    @ApiOperation(value = "获取当前项目的所有成员(当前成员存在于团队中)",httpMethod = "GET")
    public R memberLists(@PathVariable(value = "projectId")Long projectId){

        return conceptualProgressService.memberLists(projectId);
    }
}
